home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / Format / asn / ut_asn.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  1.1 KB  |  72 lines

  1. /* ut_asn.c - Common routines to manipulate ASNBODY */
  2.  
  3. # ifndef lint
  4. static char Rcsid[] = "@(#)$Header: /xtel/pp/pp-beta/Format/asn/RCS/ut_asn.c,v 6.0 1991/12/18 20:16:07 jpo Rel $";
  5. # endif
  6.  
  7. /*
  8.  * $Header: /xtel/pp/pp-beta/Format/asn/RCS/ut_asn.c,v 6.0 1991/12/18 20:16:07 jpo Rel $
  9.  *
  10.  * $Log: ut_asn.c,v $
  11.  * Revision 6.0  1991/12/18  20:16:07  jpo
  12.  * Release 6.0
  13.  *
  14.  */
  15.  
  16.  
  17.  
  18.  
  19. #include    "head.h"
  20. #include    "asn.h" 
  21.  
  22.  
  23.  
  24.  
  25. /* ------------------------  Start Routines --------------------------------- */
  26.  
  27.  
  28.  
  29.  
  30. asnbody_add (base, value, len)
  31. ASNBODY    **base;
  32. char    *value;
  33. int    len;
  34. {
  35.     ASNBODY        *ap = *base; 
  36.     ASNBODY        *new;
  37.  
  38.  
  39.     PP_TRACE (("asnbody_add (%d)", len));
  40.  
  41.  
  42.     new = (ASNBODY *) smalloc (sizeof(ASNBODY));
  43.     bzero ((char *) new, sizeof (*new));
  44.     new -> line   = value;
  45.     new -> length = len;
  46.  
  47.  
  48.     if (ap == NULLASNBODY)
  49.         *base = new;
  50.     else {
  51.         while (ap -> next != NULLASNBODY)
  52.             ap = ap -> next;
  53.         ap -> next = new;
  54.     }
  55. }
  56.  
  57.  
  58.  
  59.  
  60. asnbody_free (data)
  61. ASNBODY    *data;
  62. {
  63.     ASNBODY    *ap;
  64.  
  65.     for (; data; data = ap) {
  66.         ap = data -> next;
  67.         if (data -> line)
  68.             free (data -> line);
  69.         free ((char *)data);
  70.     }
  71. }
  72.